<?php

	//查询用户余额等级等信息接口	-get_customer.php
	//create by L 
	//http://42.121.57.193:7788/platform/get_customer.php?phone=13011112222
	//返回 0|余额数字|等级|绑定号码|UUID

	include_once "init.php";
	
	$phone = $_GET["phone"];

	if('' == $phone )
	{
		die("-1|电话号码不可以为空");
	}
	if (strlen($phone) != 11 || false==is_numeric($phone) || ord($phone)!=49)
	{
		die("-1|手机号码必须是11位数字，并且以1开头");
	}
	$con    = db_connect(DB_NAME);
	$res = mysql_query("SELECT uuid,grade,band_phone from user where phone='$phone'") or die("-1|查询数据库错误");
	$row = mysql_fetch_row($res);
		
	if (empty($row))
	{
		mysql_close($con);
		die("-1|该手机号码未注册");
	}
	mysql_close($con);
	$uuid 			=$row['0'];
	$account     	= 'a_'.$row[0];
	$loginName	   	= VOS_USER;
	$loginPassword 	= VOS_PW;

	$result = getcustomer($loginName,$loginPassword,$account);	
	
	if('0'!=$result[0]&&'|'!=$result[1])
	{
		die("-1|获取账户信息失败");
	}
	else
	{
		
		$content = split (';', substr($result,2));
		$account = round($content['2'],2);
		echo '0|'.$account.'|'.$row['1'].'|'.$row['2'].'|'.$uuid;
	}	
?>